﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using JJCore.CommonMVC.Results;
using JJServices.FileService.Interface;
using System.Web.Hosting;

namespace jamie_jonesAdmin.Controllers
{
    public class ServiceController : Controller
    {
        private IFileService fileService;
        public ServiceController(IFileService fileService)
        {
            this.fileService = fileService;
            this.fileService.ApplicationPath = @HostingEnvironment.ApplicationPhysicalPath;
        }

        public virtual ThumbnailResult Thumbnail(int width, int height, string path, string filename)
        {
            return new ThumbnailResult(width, height, path, filename);
        }

        public virtual JsonResult ContentImages()
        {
           JsonResult result = this.Json(fileService.FilesInDirectory("Content/Images/ContentImages"));
            result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            
            return result;
        }

    }
}
